package com.chinasoft.maysham.manager.config;

import com.github.mongobee.Mongobee;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;

import javax.annotation.Resource;

@Configuration
public class MongobeeConfig {

    @Resource
    private MongoTemplate mongoTemplate;

    @Bean
    public Mongobee mongobee(){
        Mongobee runner = new Mongobee("mongodb://localhost:8635/app");
        runner.setDbName("app");         // host must be set if not set in URI
        runner.setLockCollectionName("_upgrade_lock");
        runner.setChangelogCollectionName("_upgrade");
        runner.setMongoTemplate(mongoTemplate);
        runner.setChangeLogsScanPackage(
                "com.chinasoft.maysham.manager.upgrade"); // the package to be scanned for changesets

        return runner;
    }
}
